<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>产品栏目列表</title>
    <meta name="keywords" content="S.Hackles--后台管理系统">
    <meta name="description" content="S.Hackles--后台管理系统">

    <link rel="shortcut icon" href="/favicon.ico">
    <link href="/Public/Admin/css/bootstrap.min14ed.css" rel="stylesheet">
    <link href="/Public/Admin/css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <!-- Gritter -->
    <link href="/Public/Admin/js/plugins/gritter/jquery.gritter.css" rel="stylesheet">
    <!-- Morris -->
    <link href="/Public/Admin/css/plugins/morris/morris-0.4.3.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/animate.min.css" rel="stylesheet">
    <link href="/Public/Admin/css/style.min862f.css" rel="stylesheet">
    <link href="/Public/Admin/css/plugins/switchery/switchery.css" rel="stylesheet">
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>产品栏目列表</h5>
                    </div>
                    <div class="ibox-content">
                        <div class="row m-b-sm m-t-sm">
                            <div class="col-md-2">
                                <a href="<?php echo U('Admin/Category/add');?>" class="btn btn-outline btn-primary">添加产品栏目</a>
                            </div>
                        </div>
                        <table class="table table-bordered">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>栏目名称</th>
                                    <th>英文名称</th>
                                    <th>SEO标题</th>
                                    <th>SEO关键词</th>
                                    <th>SEO描述</th>
                                    <th>排序</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody id="pageView">
                                <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?><tr>
                                        <td><?php echo ($v["id"]); ?></td>
                                        <td><?php echo ($v["html"]); echo ($v["title"]); ?></td>
                                        <td><?php echo ($v["columns"]); ?></td>
                                        <td><?php echo ($v["seo_title"]); ?></td>
                                        <td><?php echo ($v["seo_keyword"]); ?></td>
                                        <td><?php echo ($v["seo_description"]); ?></td>
                                        <td><?php echo ($v["px"]); ?></td>
                                        <td>
                                            <?php if(v.status): ?><a href="javascript:statusChange(<?php echo ($v["id"]); ?>);" class="btn btn-outline btn-sm btn-primary" id="status<?php echo ($v["id"]); ?>">正常</a>
                                            <?php else: ?>
                                                <a href="javascript:statusChange(<?php echo ($v["id"]); ?>);" class="btn btn-outline btn-sm btn-danger" id="status<?php echo ($v["id"]); ?>">禁用</a><?php endif; ?>
                                        </td>
                                        <td>
                                            <div class="col-md-12">
                                                <a class="btn btn-sm btn-outline btn-warning" href="<?php echo U('Admin/Category/add/pid/'.$v['id']);?>"><i class="fa fa-edit"></i>添加子栏目</a>
                                                <a class="btn btn-sm btn-outline btn-warning" href="<?php echo U('Admin/Category/edit/id/'.$v['id']);?>"><i class="fa fa-edit"></i> 修改</a>
                                                <a class="btn btn-sm btn-outline btn-danger" href="javascript:del(<?php echo ($v["id"]); ?>)"><i class="fa fa-trash-o"></i> 删除</a>
                                            </div>
                                        </td>
                                    </tr><?php endforeach; endif; else: echo "" ;endif; ?>
                            </tbody>
                        </table>
                        <!--laypage 分页-->
                        <div id="pageList" style="text-align: center;"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="/Public/Admin/js/jquery.min.js"></script>
    <script src="/Public/Admin/js/bootstrap.min.js"></script>
    <script src="/Public/Admin/js/plugins/layer.3/layer.js"></script>
    <script src="/Public/Admin/js/plugins/laypage/laypage.js"></script>
    <script src="/Public/Admin/js/common.js"></script>

    <script>
        $(function(){
            /**
             * 更改管理员状态
             */
            statusChange = function(id){
                common.ajaxStatusChange("<?php echo U('Admin/Category/statusChange');?>", id, $('#status' + id));
            };

            /**
             * 删除管理员
             * @param id
             */
            del = function(id){
                common.ajaxDel("<?php echo U('Admin/Category/del');?>",id,"<?php echo U('Admin/Category/index');?>");
            };

        });
    </script>
</body>
</html>